package com.basic;

import com.frame.struts.BaseBean;
import java.util.Date;
import javax.servlet.http.HttpServletRequest;
import com.utils.CommUtil;
import javax.servlet.http.HttpServletResponse;
import com.frame.struts.ActionContext;

/**
 * <p>Title: </p>
 * <p>Description: </p>
 * <p>Copyright: Copyright (c) 2006</p>
 * <p>Company: </p>
 * @author not attributable
 * @version 1.0
 */

public class BankCreditForm extends BaseBean {
    public BankCreditForm() {
    }

	BankCreditEntity bankCredit = new BankCreditEntity();
	private String oldId="";
	public String addBankCredit() {
		HttpServletRequest request = ActionContext.getActionContext().
			getRequest();
		HttpServletResponse response = ActionContext.getActionContext().
			getResponse();
		BasicFactory factory = new BasicFactory();
		String qyid = (String) request.getSession().getAttribute("session_qyid");
		bankCredit.setQyid(qyid);
		bankCredit.setOptdate(new Date());
		bankCredit.setOptrid(CommUtil.getUserId(request));
		try{
		if (factory.addBankCredit(bankCredit)) {
			    response.sendRedirect("/basic/queryBankCredit.jsp");
				return "success";
		}
		response.sendRedirect("/basic/failed.jsp");
	}
	catch (Exception e) {

	}

			return "failed";
	}

	public String modifyBankCredit(){
			HttpServletRequest request = ActionContext.getActionContext().
				getRequest();
			HttpServletResponse response = ActionContext.getActionContext().
				getResponse();
			BasicFactory factory = new BasicFactory();
			String qyid = (String) request.getSession().getAttribute("session_qyid");
			bankCredit.setQyid(qyid);
			bankCredit.setOptdate(new Date());
			bankCredit.setOptrid(CommUtil.getUserId(request));
			factory.deleteBankCredit(qyid,this.getOldId());
            try{
			if(factory.addBankCredit(bankCredit)){
				response.sendRedirect("/basic/queryBankCredit.jsp");
				return "success";
			}
			response.sendRedirect("/basic/failed.jsp");
		}
		catch (Exception e) {

		}

			return "failed";
		}
		public String getOldId(){
			return this.oldId;
		}
		public void setOldId(String oldId){
			this.oldId=oldId;
		}

	public Date getOptdate() {
		return bankCredit.getOptdate();
	}
	/**
	 * @param optdate The optdate to set.
	 */
	public void setOptdate(Date optdate) {
		bankCredit.setOptdate(optdate);
	}
	/**
	 * @return bankCredit. return bankCredit.s the optrid.
	 */
	public String getOptrid() {
		return bankCredit.getOptrid();
	}
	/**
	 * @param optrid The optrid to set.
	 */
	public void setOptrid(String optrid) {
		bankCredit.setOptrid(optrid);
	}
	/**
	 * @return bankCredit. return bankCredit.s the qyid.
	 */
	public String getQyid() {
		return bankCredit.getQyid();
	}
	/**
	 * @param qyid The qyid to set.
	 */
	public void setQyid(String qyid) {
		bankCredit.setQyid(qyid);
	}
	/**
	 * @return bankCredit. return bankCredit.s the recstate.
	 */
	public String getRecstate() {
		return bankCredit.getRecstate();
	}
	/**
	 * @param recstate The recstate to set.
	 */
	public void setRecstate(String recstate) {
		bankCredit.setRecstate(recstate);
	}
	/**
	 * @return bankCredit. return bankCredit.s the remark.
	 */
	public String getRemark() {
		return bankCredit.getRemark();
	}
	/**
	 * @param remark The remark to set.
	 */
	public void setRemark(String remark) {
		bankCredit.setRemark(remark);
	}
	/**
	 * @return bankCredit. return bankCredit.s the xydj.
	 */
	public String getXydj() {
		return bankCredit.getXydj();
	}
	/**
	 * @param xydj The xydj to set.
	 */
	public void setXydj(String xydj) {
		bankCredit.setXydj(xydj);
	}
	/**
	 * @return bankCredit. return bankCredit.s the yhmc.
	 */
	public String getYhmc() {
		return bankCredit.getYhmc();
	}
	/**
	 * @param yhmc The yhmc to set.
	 */
	public void setYhmc(String yhmc) {
		bankCredit.setYhmc(yhmc);
	}

}